This program lists blocks within block groups that only partially intersect with community districts.

Load relevant files

# Important abbreviations:
#    bg = block group
#    bl = block
#    cd = community district
#    co = county
#    nbd=neighborhood
#    tr = tract

library(glue)
library(magrittr)
library(sf)
## Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5     v purrr   0.3.4
## v tibble  3.1.6     v dplyr   1.0.8
## v tidyr   1.2.0     v stringr 1.4.0
## v readr   2.1.2     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x tidyr::extract()   masks magrittr::extract()
## x dplyr::filter()    masks stats::filter()
## x dplyr::lag()       masks stats::lag()
## x purrr::set_names() masks magrittr::set_names()
library(dplyr)
path_name <- "../data/"
terse <- FALSE
conditional_glimpse <- function(x) {
  if (terse) return(invisible())
  cat("\n\n")
  cat(deparse(substitute(x)))
  cat("\n\n")
  glimpse(x)
  cat("\n\n")
  return(invisible())
}

test1 <- data.frame(x=1:3, y=4:6)
conditional_glimpse(test1)
## 
## 
## test1
## 
## Rows: 3
## Columns: 2
## $ x <int> 1, 2, 3
## $ y <int> 4, 5, 6

Test acs download

library(tidycensus)
## Warning: package 'tidycensus' was built under R version 4.1.3
county_list <- c(
  "Johnson",
  "Leavenworth",
  "Wyandotte",
  "Cass",
  "Clay",
  "Jackson",
  "Platte")
state_list <- rep(c("KS", "MO"), c(3,4))

vlist <- c("B01001_003", "B01001_027")
load_variables(2020, "acs5", cache = TRUE) %>%
  filter(name %in% vlist)
## # A tibble: 2 x 3
##   name       label                                    concept   
##   <chr>      <chr>                                    <chr>     
## 1 B01001_003 Estimate!!Total:!!Male:!!Under 5 years   SEX BY AGE
## 2 B01001_027 Estimate!!Total:!!Female:!!Under 5 years SEX BY AGE
acs_children <- NULL
for (i in 1:7) {
  acs1 <- get_acs(
    geography = "cbg", 
    variables = vlist, 
    state=state_list[i],
    county=county_list[i],
    year = 2020)
  acs_children <- rbind(acs_children, acs1)
}
## Getting data from the 2016-2020 5-year ACS
## Getting data from the 2016-2020 5-year ACS
## Getting data from the 2016-2020 5-year ACS
## Getting data from the 2016-2020 5-year ACS
## Getting data from the 2016-2020 5-year ACS
## Getting data from the 2016-2020 5-year ACS
## Getting data from the 2016-2020 5-year ACS
glimpse(acs_children)
## Rows: 3,368
## Columns: 5
## $ GEOID    <chr> "200910500001", "200910500001", "200910500002", "200910500002~
## $ NAME     <chr> "Block Group 1, Census Tract 500, Johnson County, Kansas", "B~
## $ variable <chr> "B01001_003", "B01001_027", "B01001_003", "B01001_027", "B010~
## $ estimate <dbl> 0, 50, 21, 18, 28, 14, 36, 8, 19, 0, 30, 106, 46, 150, 34, 52~
## $ moe      <dbl> 11, 49, 15, 17, 16, 11, 22, 9, 25, 11, 30, 79, 58, 110, 32, 6~
acs_children %<>% 
  group_by(GEOID) %>% 
  summarize(estimate=sum(estimate)) %>%
  rename(bg_id=GEOID)
glimpse(acs_children)
## Rows: 1,684
## Columns: 2
## $ bg_id    <chr> "200910500001", "200910500002", "200910500003", "200910500004~
## $ estimate <dbl> 50, 39, 42, 44, 19, 136, 196, 86, 65, 87, 38, 133, 150, 64, 1~

Contents of bg

load(glue("{path_name}bg.RData"))
conditional_glimpse(bg)
## 
## 
## bg
## 
## Rows: 1,684
## Columns: 4
## $ bg_id    <chr> "201039819003", "201030714004", "201030711041", "201030712051~
## $ bg_name  <chr> "Block Group 3", "Block Group 4", "Block Group 1", "Block Gro~
## $ bg_area  <dbl> 984975.5, 36602869.0, 18313082.5, 26007918.3, 11448660.8, 243~
## $ geometry <POLYGON [°]> POLYGON ((-94.94756 39.3373..., POLYGON ((-95.18756 3~

Contents of bl

load(glue("{path_name}bl.RData"))
conditional_glimpse(bl)
## 
## 
## bl
## 
## Rows: 39,903
## Columns: 4
## $ bl_id    <chr> "200910518012010", "200910514003006", "200910515002005", "200~
## $ bl_name  <chr> "Block 2010", "Block 3006", "Block 2005", "Block 1009", "Bloc~
## $ bl_area  <dbl> 38500.823, 51711.677, 104537.047, 73933.762, 95854.528, 19934~
## $ geometry <POLYGON [°]> POLYGON ((-94.64213 38.9774..., POLYGON ((-94.63966 3~

Contents of cd

load(glue("{path_name}cd.RData"))
conditional_glimpse(cd)
## 
## 
## cd
## 
## Rows: 59
## Columns: 4
## $ cd_id    <dbl> 106, 108, 113, 102, 129, 116, 114, 101, 105, 103, 107, 109, 1~
## $ cd_name  <chr> "East Side", "Old Northeast", "Greater Downtown", "Blue Valle~
## $ cd_area  <dbl> 281713850, 118237219, 181920811, 216842678, 412671242, 264282~
## $ geometry <POLYGON [°]> POLYGON ((-94.52337 39.0941..., POLYGON ((-94.50777 3~

Contents of co

load(glue("{path_name}co.RData"))
conditional_glimpse(co)
## 
## 
## co
## 
## Rows: 220
## Columns: 19
## $ STATEFP  <chr> "29", "29", "20", "20", "20", "29", "29", "20", "20", "29", "~
## $ COUNTYFP <chr> "083", "011", "073", "043", "157", "103", "117", "039", "147"~
## $ COUNTYNS <chr> "00758496", "00758460", "00485003", "00484991", "00485042", "~
## $ GEOID    <chr> "29083", "29011", "20073", "20043", "20157", "29103", "29117"~
## $ NAME     <chr> "Henry", "Barton", "Greenwood", "Doniphan", "Republic", "Knox~
## $ NAMELSAD <chr> "Henry County", "Barton County", "Greenwood County", "Donipha~
## $ LSAD     <chr> "06", "06", "06", "06", "06", "06", "06", "06", "06", "06", "~
## $ CLASSFP  <chr> "H1", "H1", "H1", "H1", "H1", "H1", "H1", "H1", "H1", "H1", "~
## $ MTFCC    <chr> "G4020", "G4020", "G4020", "G4020", "G4020", "G4020", "G4020"~
## $ CSAFP    <chr> NA, NA, NA, "312", NA, NA, NA, NA, NA, "312", NA, NA, NA, NA,~
## $ CBSAFP   <chr> NA, NA, NA, "41140", NA, NA, NA, NA, NA, "47660", NA, "21380"~
## $ METDIVFP <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N~
## $ FUNCSTAT <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "~
## $ ALAND    <dbl> 1805054746, 1533351028, 2961143636, 1019105691, 1857998463, 1~
## $ AWATER   <dbl> 91657543, 12152201, 24145021, 12424174, 7951912, 7307094, 161~
## $ INTPTLAT <chr> "+38.3864909", "+37.5007989", "+37.8793472", "+39.7885021", "~
## $ INTPTLON <chr> "-093.7926278", "-094.3440893", "-096.2417321", "-095.1472253~
## $ geometry <MULTIPOLYGON [°]> MULTIPOLYGON (((-93.51565 3..., MULTIPOLYGON (((~
## $ label    <chr> "Henry", "Barton", "Greenwood", "Doniphan", "Republic", "Knox~

Contents of cd-intersections

load(glue("{path_name}cd-intersections.RData"))
conditional_glimpse(bg_cd_intersection)
## 
## 
## bg_cd_intersection
## 
## Rows: 1,236
## Columns: 3
## $ bg_id      <chr> "290950161001", "290950166002", "290950060001", "2909500340~
## $ cd_id      <dbl> 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,~
## $ bg_prop_in <dbl> 0.8919314491, 1.0000000000, 1.0000000000, 1.0000000000, 0.3~
conditional_glimpse(bl_cd_intersection)
## 
## 
## bl_cd_intersection
## 
## Rows: 15,748
## Columns: 5
## $ tr_id      <chr> "29095002300", "29095006300", "29095002200", "29095002200",~
## $ bg_id      <chr> "290950023002", "290950063002", "290950022003", "2909500220~
## $ bl_id      <chr> "290950023002014", "290950063002017", "290950022003001", "2~
## $ cd_id      <dbl> 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,~
## $ bl_prop_in <dbl> 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 0.997, 0.001, 0.0~

Contents of cd-weights

load(glue("{path_name}cd-weights.RData"))
conditional_glimpse(bg_counts)
## 
## 
## bg_counts
## 
## Rows: 1,236
## Columns: 6
## Groups: bg_id [776]
## $ bg_id     <chr> "200910500001", "200910500002", "200910500003", "20091050100~
## $ cd_id     <dbl> 209, 209, 209, 209, 211, 209, 211, 211, 112, 112, 112, 111, ~
## $ people_in <dbl> 1, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, ~
## $ units_in  <dbl> 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ~
## $ people    <dbl> 744, 695, 751, 1313, 1313, 1196, 643, 630, 778, 961, 1210, 9~
## $ units     <dbl> 341, 311, 377, 648, 648, 549, 315, 444, 287, 335, 461, 430, ~
conditional_glimpse(bg_list)
## 
## 
## bg_list
## 
##  chr [1:776] "290950161001" "290950166002" "290950060001" "290950034004" ...
conditional_glimpse(bl_counts)
## 
## 
## bl_counts
## 
## Rows: 41,220
## Columns: 6
## $ bg_id     <chr> "290950023002", "290950063002", "290950022003", "29095002200~
## $ bl_id     <chr> "290950023002014", "290950063002017", "290950022003001", "29~
## $ cd_id     <dbl> 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, ~
## $ prop_in   <dbl> 1.000000000, 1.000000000, 1.000000000, 1.000000000, 1.000000~
## $ people_in <dbl> 62, 0, 22, 26, 42, 49, 43, 0, 0, 20, 5, 56, 58, 48, 47, 13, ~
## $ units_in  <dbl> 18, 0, 9, 18, 22, 22, 14, 0, 0, 10, 4, 12, 19, 24, 28, 4, 48~
conditional_glimpse(bl_list)
## 
## 
## bl_list
## 
## Rows: 17,547
## Columns: 2
## $ bg_id <chr> "200910533013", "200910533024", "200910533024", "200910534291", ~
## $ bl_id <chr> "200910533013008", "200910533024013", "200910533024008", "200910~

Contents of red

load(glue("{path_name}red.RData"))
conditional_glimpse(red)
## 
## 
## red
## 
## Rows: 39,903
## Columns: 4
## $ bg_id  <chr> "200910500001", "200910500001", "200910500001", "200910500001",~
## $ bl_id  <chr> "200910500001000", "200910500001001", "200910500001002", "20091~
## $ people <dbl> 52, 47, 51, 58, 138, 68, 35, 81, 39, 37, 35, 51, 52, 106, 45, 8~
## $ units  <dbl> 33, 29, 27, 26, 70, 34, 18, 28, 12, 11, 15, 17, 21, 49, 20, 39,~

Subset co to seven counties

clist <- c(
  "20091",
  "20103",
  "20209",
  "29037",
  "29047",
  "29095",
  "29165")
co                                     %>%
  filter(GEOID %in% clist)             -> co
conditional_glimpse(co)
## 
## 
## co
## 
## Rows: 7
## Columns: 19
## $ STATEFP  <chr> "29", "29", "20", "20", "29", "29", "20"
## $ COUNTYFP <chr> "037", "165", "091", "209", "095", "047", "103"
## $ COUNTYNS <chr> "00758473", "00758537", "00485010", "00485065", "00758502", "~
## $ GEOID    <chr> "29037", "29165", "20091", "20209", "29095", "29047", "20103"
## $ NAME     <chr> "Cass", "Platte", "Johnson", "Wyandotte", "Jackson", "Clay", ~
## $ NAMELSAD <chr> "Cass County", "Platte County", "Johnson County", "Wyandotte ~
## $ LSAD     <chr> "06", "06", "06", "06", "06", "06", "06"
## $ CLASSFP  <chr> "H1", "H1", "H1", "H6", "H1", "H1", "H1"
## $ MTFCC    <chr> "G4020", "G4020", "G4020", "G4020", "G4020", "G4020", "G4020"
## $ CSAFP    <chr> "312", "312", "312", "312", "312", "312", "312"
## $ CBSAFP   <chr> "28140", "28140", "28140", "28140", "28140", "28140", "28140"
## $ METDIVFP <chr> NA, NA, NA, NA, NA, NA, NA
## $ FUNCSTAT <chr> "A", "A", "A", "C", "A", "A", "A"
## $ ALAND    <dbl> 1804223313, 1087283058, 1226679688, 392739381, 1565698757, 10~
## $ AWATER   <dbl> 14963188, 16949451, 16319024, 11801597, 30621016, 28508804, 1~
## $ INTPTLAT <chr> "+38.6464737", "+39.3786900", "+38.8839065", "+39.1153842", "~
## $ INTPTLON <chr> "-094.3545467", "-094.7614765", "-094.8223295", "-094.7630866~
## $ geometry <MULTIPOLYGON [°]> MULTIPOLYGON (((-94.11966 3..., MULTIPOLYGON (((-94.65596 3..~
## $ label    <chr> "Cass", "Platte", "Johnson", "Wyandotte", "Jackson", "Clay", ~

Get id values for all community districts

cd                                     %>%
  tibble                               %>%
  distinct(cd_id)                      %>%
  arrange(cd_id)                       %>%
  pull(cd_id)                           -> cd_list

High level view

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Blocks inside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950161001012     100     17     0        17        0
## 2  290950161001007     100      0     0         0        0
## 3  290950161001008     100      0     0         0        0
## 4  290950161001009     100      0     0         0        0
## 5  290950161001010     100      0     0         0        0
## 6  290950161001011     100      0     0         0        0
## 7  290950161001013     100      0     0         0        0
## 8  290950161001014      98      0     0         0        0
## 9  290950161001015      95      0     0         0        0
## 10 290950161001028      44      0     0         0        0
## 11 290950161001032      17      0     0         0        0
## 
## Blocks outside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950161001006       1     62    60         0        0
## 2  290950161001016       1      0     0         0        0
## 3  290950161001029       1      0     0         0        0
## 4  290950161001025       0     11     1         0        0
## 5  290950161001017       0      0     0         0        0
## 6  290950161001018       0      0     0         0        0
## 7  290950161001034       0      0     0         0        0
## 8  290950161001019       0    166    88         0        0
## 9  290950161001039       0     76    61         0        0
## 10 290950161001004       0     64    57         0        0
## 11 290950161001005       0     33    26         0        0
## 12 290950161001045       0     29    12         0        0
## 13 290950161001041       0     28    11         0        0
## 14 290950161001042       0     28    12         0        0
## 15 290950161001048       0     28    13         0        0
## 16 290950161001043       0     25    12         0        0
## 17 290950161001054       0     19    11         0        0
## 18 290950161001046       0     18    17         0        0
## 19 290950161001044       0     16    10         0        0
## 20 290950161001030       0     14     4         0        0
## 21 290950161001051       0     13     5         0        0
## 22 290950161001052       0     12     6         0        0
## 23 290950161001038       0     11     1         0        0
## 24 290950161001040       0     11     1         0        0
## 25 290950161001058       0     11     4         0        0
## 26 290950161001056       0     10     1         0        0
## 27 290950161001049       0      8     6         0        0
## 28 290950161001050       0      7     8         0        0
## 29 290950161001031       0      6     8         0        0
## 30 290950161001057       0      6     3         0        0
## 31 290950161001026       0      2     1         0        0
## 32 290950161001000       0      0     0         0        0
## 33 290950161001001       0      0     0         0        0
## 34 290950161001002       0      0     0         0        0
## 35 290950161001003       0      0     0         0        0
## 36 290950161001020       0      0     0         0        0
## 37 290950161001021       0      0     0         0        0
## 38 290950161001022       0      0     0         0        0
## 39 290950161001023       0      0     0         0        0
## 40 290950161001024       0      0     0         0        0
## 41 290950161001027       0      0     0         0        0
## 42 290950161001033       0      0     0         0        0
## 43 290950161001035       0      0     0         0        0
## 44 290950161001036       0      0     0         0        0
## 45 290950161001037       0      0     0         0        0
## 46 290950161001047       0      0     0         0        0
## 47 290950161001053       0      0     0         0        0
## 48 290950161001055       0      0     0         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1        17        0    731   439
## 
## Cross check
## 
##   people_in units_in people units
## 1        17        0    731   439
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Blocks inside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950161002029     100      0     0         0        0
## 2  290950161002030     100      0     0         0        0
## 3  290950161002031     100      0     0         0        0
## 4  290950161002032     100      0     0         0        0
## 5  290950161002033     100      0     0         0        0
## 6  290950161002034     100      0     0         0        0
## 7  290950161002035     100      0     0         0        0
## 8  290950161002036     100      0     0         0        0
## 9  290950161002037     100      0     0         0        0
## 10 290950161002038     100      0     0         0        0
## 11 290950161002039     100      0     0         0        0
## 12 290950161002040     100      0     0         0        0
## 13 290950161002041     100      0     0         0        0
## 14 290950161002042     100      0     0         0        0
## 15 290950161002043     100      0     0         0        0
## 16 290950161002044     100      0     0         0        0
## 17 290950161002045     100      0     0         0        0
## 18 290950161002046     100      0     0         0        0
## 19 290950161002064     100      0     0         0        0
## 20 290950161002065     100      0     0         0        0
## 21 290950161002066     100      0     0         0        0
## 22 290950161002067     100      0     0         0        0
## 23 290950161002068     100      0     0         0        0
## 24 290950161002063      97      0     0         0        0
## 
## Blocks outside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950161002028       1      0     0         0        0
## 2  290950161002047       1      0     0         0        0
## 3  290950161002057       0    129     0         0        0
## 4  290950161002012       0    113    48         0        0
## 5  290950161002053       0    105   144         0        0
## 6  290950161002059       0     90    74         0        0
## 7  290950161002060       0     86    88         0        0
## 8  290950161002011       0     74    21         0        0
## 9  290950161002007       0     70    59         0        0
## 10 290950161002058       0     67    50         0        0
## 11 290950161002001       0     61    37         0        0
## 12 290950161002071       0     55    47         0        0
## 13 290950161002054       0     42    41         0        0
## 14 290950161002072       0     36    40         0        0
## 15 290950161002052       0     33    40         0        0
## 16 290950161002002       0     28    13         0        0
## 17 290950161002000       0     27    21         0        0
## 18 290950161002010       0     27    11         0        0
## 19 290950161002069       0     27    25         0        0
## 20 290950161002003       0     26    19         0        0
## 21 290950161002004       0     21    23         0        0
## 22 290950161002005       0     15     3         0        0
## 23 290950161002013       0     12     2         0        0
## 24 290950161002019       0     11     3         0        0
## 25 290950161002014       0      8     2         0        0
## 26 290950161002006       0      4     9         0        0
## 27 290950161002056       0      4     1         0        0
## 28 290950161002008       0      3     2         0        0
## 29 290950161002018       0      1     1         0        0
## 30 290950161002009       0      0     0         0        0
## 31 290950161002015       0      0     0         0        0
## 32 290950161002016       0      0     0         0        0
## 33 290950161002017       0      0     0         0        0
## 34 290950161002020       0      0     0         0        0
## 35 290950161002021       0      0     0         0        0
## 36 290950161002022       0      0     0         0        0
## 37 290950161002023       0      0     0         0        0
## 38 290950161002024       0      0     0         0        0
## 39 290950161002025       0      0     0         0        0
## 40 290950161002026       0      0     0         0        0
## 41 290950161002027       0      0     0         0        0
## 42 290950161002048       0      0     0         0        0
## 43 290950161002049       0      0     0         0        0
## 44 290950161002050       0      0     0         0        0
## 45 290950161002051       0      0     0         0        0
## 46 290950161002055       0      0     0         0        0
## 47 290950161002061       0      0     0         0        0
## 48 290950161002062       0      0     0         0        0
## 49 290950161002070       0      0     0         0        0
## 50 290950161002073       0      0     0         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1         0        0   1175   824
## 
## Cross check
## 
##   people_in units_in people units
## 1         0        0   1175   824
## 
## 
## bg2
## 
## Rows: 44
## Columns: 13
## $ bg_id     <chr> "290950153001", "290950152001", "290950158002", "29095015900~
## $ bg_name   <chr> "Block Group 1", "Block Group 1", "Block Group 2", "Block Gr~
## $ bg_area   <dbl> 739852.5, 366703.0, 694293.6, 201916.6, 1182302.6, 1182302.6~
## $ ab        <chr> "0153001", "0152001", "0158002", "0159001", "0161001", "0161~
## $ cd_id     <dbl> 113, 113, 113, 113, 106, 113, 113, 114, 202, 210, 108, 113, ~
## $ people_in <dbl> 1304, 1499, 570, 762, 714, 17, 344, 0, 0, 0, 0, 827, 0, 496,~
## $ units_in  <dbl> 585, 1252, 335, 615, 439, 0, 488, 0, 0, 0, 0, 351, 0, 373, 6~
## $ people    <dbl> 1304, 1499, 570, 762, 731, 731, 344, 344, 344, 344, 827, 827~
## $ units     <dbl> 585, 1252, 335, 615, 439, 439, 488, 488, 488, 488, 351, 351,~
## $ w_p       <dbl> 1.00, 1.00, 1.00, 1.00, 0.98, 0.02, 1.00, 0.00, 0.00, 0.00, ~
## $ w_u       <dbl> 1.00, 1.00, 1.00, 1.00, 1.00, 0.00, 1.00, 0.00, 0.00, 0.00, ~
## $ estimate  <dbl> 117, 34, 0, 53, 98, 98, 0, 0, 0, 0, 73, 73, 73, 0, 7, 7, 0, ~
## $ geometry  <POLYGON [°]> POLYGON ((-94.60322 39.0863..., POLYGON ((-94.58614 ~
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): attribute variables are
## assumed to be spatially constant throughout all geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Blocks inside cd
## 
##             bl_id prop_in people units people_in units_in
## 1 290950145013006     100      3     1         3        1
## 2 290950145013005      99      5     2         5        2
## 
## Blocks outside cd
## 
##             bl_id prop_in people units people_in units_in
## 1 290950145013003       1    336   169         3        2
## 2 290950145013000       0    185   133         0        0
## 3 290950145013001       0     82    51         0        0
## 4 290950145013004       0     71    50         0        0
## 5 290950145013002       0     45    34         0        0
## 6 290950145013007       0     16     6         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1        11        5    743   446
## 
## Cross check
## 
##   people_in units_in people units
## 1        11        5    743   446
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Blocks inside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950143002000     100    339   115       339      115
## 2  290950143002013     100    305    60       305       60
## 3  290950143002015     100    107    35       107       35
## 4  290950143002017     100     90    27        90       27
## 5  290950143002041     100     63    21        63       21
## 6  290950143002016     100     62    15        62       15
## 7  290950143002001     100     52    18        52       18
## 8  290950143002009     100     39     8        39        8
## 9  290950143002040     100     37    17        37       17
## 10 290950143002025     100     30    11        30       11
## 11 290950143002004     100     22     3        22        3
## 12 290950143002002     100     18     4        18        4
## 13 290950143002007     100     18     3        18        3
## 14 290950143002031     100     15     3        15        3
## 15 290950143002005     100     14     6        14        6
## 16 290950143002008     100     11     1        11        1
## 17 290950143002003     100      0     0         0        0
## 18 290950143002006     100      0     0         0        0
## 19 290950143002010     100      0     0         0        0
## 20 290950143002011     100      0     0         0        0
## 21 290950143002012     100      0     0         0        0
## 22 290950143002026     100      0     0         0        0
## 23 290950143002027     100      0     0         0        0
## 24 290950143002029     100      0     0         0        0
## 25 290950143002030     100      0     0         0        0
## 26 290950143002032     100      0     0         0        0
## 27 290950143002033     100      0     0         0        0
## 28 290950143002038     100      0     0         0        0
## 29 290950143002022      97     17     4        16        4
## 30 290950143002014      95      0     0         0        0
## 
## Blocks outside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950143002021      10      0     0         0        0
## 2  290950143002020       5      0     0         0        0
## 3  290950143002035       4      0     0         0        0
## 4  290950143002037       3      0     0         0        0
## 5  290950143002018       1      7     1         0        0
## 6  290950143002036       1      0     0         0        0
## 7  290950143002039       0     10     3         0        0
## 8  290950143002028       0      4     1         0        0
## 9  290950143002019       0      0     0         0        0
## 10 290950143002034       0      0     0         0        0
## 11 290950143002023       0     14    12         0        0
## 12 290950143002024       0      0     0         0        0
## 13 290950143002042       0      0     0         0        0
## 14 290950143002043       0      0     0         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1      1238      351   1274   368
## 
## Cross check
## 
##   people_in units_in people units
## 1      1238      351   1274   368
## 
## 
## bg2
## 
## Rows: 11
## Columns: 13
## $ bg_id     <chr> "290950143001", "290950176003", "290950176002", "29095017600~
## $ bg_name   <chr> "Block Group 1", "Block Group 3", "Block Group 2", "Block Gr~
## $ bg_area   <dbl> 3040094.1, 327738.2, 1075728.5, 7075242.8, 7075242.8, 125833~
## $ ab        <chr> "0143001", "0176003", "0176002", "0176004", "0176004", "0143~
## $ cd_id     <dbl> 129, 129, 129, 128, 129, 129, 129, 129, 128, 129, 129
## $ people_in <dbl> 1881, 774, 1169, 0, 958, 929, 1390, 11, 0, 1238, 2195
## $ units_in  <dbl> 752, 338, 465, 0, 433, 427, 669, 5, 0, 351, 843
## $ people    <dbl> 1888, 775, 1169, 963, 963, 931, 1390, 743, 1274, 1274, 2211
## $ units     <dbl> 755, 339, 465, 433, 433, 429, 669, 446, 368, 368, 850
## $ w_p       <dbl> 1.00, 1.00, 1.00, 0.00, 0.99, 1.00, 1.00, 0.01, 0.00, 0.97, ~
## $ w_u       <dbl> 1.00, 1.00, 1.00, 0.00, 1.00, 1.00, 1.00, 0.01, 0.00, 0.95, ~
## $ estimate  <dbl> 148, 20, 69, 40, 40, 68, 65, 13, 54, 54, 111
## $ geometry  <POLYGON [°]> POLYGON ((-94.43065 39.0133..., POLYGON ((-94.44412 39.0089.~
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): attribute variables are
## assumed to be spatially constant throughout all geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Blocks inside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950074001011     100    389     0       389        0
## 2  290950074001021     100     79    33        79       33
## 3  290950074001028     100     77    25        77       25
## 4  290950074001032     100     77    21        77       21
## 5  290950074001033     100     68    39        68       39
## 6  290950074001031     100     65    30        65       30
## 7  290950074001034     100     58    19        58       19
## 8  290950074001030     100     55    19        55       19
## 9  290950074001020     100     53    24        53       24
## 10 290950074001022     100     52    23        52       23
## 11 290950074001017     100     43     3        43        3
## 12 290950074001019     100     39    16        39       16
## 13 290950074001025     100     33    11        33       11
## 14 290950074001027     100     28    10        28       10
## 15 290950074001029     100     23     8        23        8
## 16 290950074001026     100     20    10        20       10
## 17 290950074001014     100     11     1        11        1
## 18 290950074001018     100     11     1        11        1
## 19 290950074001012     100      3     1         3        1
## 20 290950074001004     100      0     0         0        0
## 21 290950074001005     100      0     0         0        0
## 22 290950074001009     100      0     0         0        0
## 23 290950074001010     100      0     0         0        0
## 24 290950074001013     100      0     0         0        0
## 25 290950074001015     100      0     0         0        0
## 26 290950074001016     100      0     0         0        0
## 27 290950074001023     100      0     0         0        0
## 28 290950074001024     100      0     0         0        0
## 29 290950074001003      99      0     0         0        0
## 
## Blocks outside cd
## 
##             bl_id prop_in people units people_in units_in
## 1 290950074001000       0     19    11         0        0
## 2 290950074001006       0     11     2         0        0
## 3 290950074001007       0     19    11         0        0
## 4 290950074001008       0     15     6         0        0
## 5 290950074001002       0      3     3         0        0
## 6 290950074001001       0      0     0         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1      1184      294   1251   327
## 
## Cross check
## 
##   people_in units_in people units
## 1      1184      294   1251   327
## 
## 
## bg2
## 
## Rows: 28
## Columns: 13
## $ bg_id     <chr> "290950073011", "290950073011", "290950073011", "29095008600~
## $ bg_name   <chr> "Block Group 1", "Block Group 1", "Block Group 1", "Block Gr~
## $ bg_area   <dbl> 81990.19, 81990.19, 81990.19, 309428.90, 309428.90, 310148.4~
## $ ab        <chr> "0073011", "0073011", "0073011", "0086005", "0086005", "0086~
## $ cd_id     <dbl> 103, 107, 112, 103, 112, 103, 112, 103, 103, 107, 103, 112, ~
## $ people_in <dbl> 991, 6, 1, 765, 0, 832, 0, 742, 1184, 67, 1114, 2, 955, 0, 6~
## $ units_in  <dbl> 783, 5, 1, 339, 0, 341, 0, 370, 294, 33, 813, 2, 372, 0, 372~
## $ people    <dbl> 999, 999, 999, 765, 765, 832, 832, 742, 1251, 1251, 1116, 11~
## $ units     <dbl> 789, 789, 789, 339, 339, 341, 341, 370, 327, 327, 815, 815, ~
## $ w_p       <dbl> 0.99, 0.01, 0.00, 1.00, 0.00, 1.00, 0.00, 1.00, 0.95, 0.05, ~
## $ w_u       <dbl> 0.99, 0.01, 0.00, 1.00, 0.00, 1.00, 0.00, 1.00, 0.90, 0.10, ~
## $ estimate  <dbl> 26, 26, 26, 0, 0, 38, 38, 85, 66, 66, 0, 0, 14, 14, 95, 117,~
## $ geometry  <POLYGON [°]> POLYGON ((-94.59171 39.0389..., POLYGON ((-94.59171 ~
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): attribute variables are
## assumed to be spatially constant throughout all geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Blocks inside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950073021010     100    428   437       428      437
## 2  290950073021005     100    242   188       242      188
## 3  290950073021009     100     94    84        94       84
## 4  290950073021011     100     39    33        39       33
## 5  290950073021006     100     32    18        32       18
## 6  290950073021001     100     12     2        12        2
## 7  290950073021000     100      0     0         0        0
## 8  290950073021002     100      0     0         0        0
## 9  290950073021003     100      0     0         0        0
## 10 290950073021004     100      0     0         0        0
## 11 290950073021007     100      0     0         0        0
## 12 290950073021008     100      0     0         0        0
## 
## Blocks outside cd
## 
##             bl_id prop_in people units people_in units_in
## 1 290950073021012       2      0     0         0        0
## 2 290950073021013       2      0     0         0        0
## 3 290950073021014       0      0     0         0        0
## 4 290950073021015       0      0     0         0        0
## 5 290950073021016       0      0     0         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1       847      762    847   762
## 
## Cross check
## 
##   people_in units_in people units
## 1       847      762    847   762
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Blocks inside cd
## 
##             bl_id prop_in people units people_in units_in
## 1 290950074001000     100     19    11        19       11
## 2 290950074001007     100     19    11        19       11
## 3 290950074001008     100     15     6        15        6
## 4 290950074001006     100     11     2        11        2
## 5 290950074001002     100      3     3         3        3
## 6 290950074001001     100      0     0         0        0
## 
## Blocks outside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950074001003       1      0     0         0        0
## 2  290950074001005       0      0     0         0        0
## 3  290950074001011       0    389     0         0        0
## 4  290950074001021       0     79    33         0        0
## 5  290950074001028       0     77    25         0        0
## 6  290950074001032       0     77    21         0        0
## 7  290950074001033       0     68    39         0        0
## 8  290950074001031       0     65    30         0        0
## 9  290950074001034       0     58    19         0        0
## 10 290950074001030       0     55    19         0        0
## 11 290950074001020       0     53    24         0        0
## 12 290950074001022       0     52    23         0        0
## 13 290950074001017       0     43     3         0        0
## 14 290950074001019       0     39    16         0        0
## 15 290950074001025       0     33    11         0        0
## 16 290950074001027       0     28    10         0        0
## 17 290950074001029       0     23     8         0        0
## 18 290950074001026       0     20    10         0        0
## 19 290950074001014       0     11     1         0        0
## 20 290950074001018       0     11     1         0        0
## 21 290950074001012       0      3     1         0        0
## 22 290950074001004       0      0     0         0        0
## 23 290950074001009       0      0     0         0        0
## 24 290950074001010       0      0     0         0        0
## 25 290950074001013       0      0     0         0        0
## 26 290950074001015       0      0     0         0        0
## 27 290950074001016       0      0     0         0        0
## 28 290950074001023       0      0     0         0        0
## 29 290950074001024       0      0     0         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1        67       33   1251   327
## 
## Cross check
## 
##   people_in units_in people units
## 1        67       33   1251   327
## 
## 
## bg2
## 
## Rows: 50
## Columns: 13
## $ bg_id     <chr> "290950071002", "290950071002", "290950051001", "29095006700~
## $ bg_name   <chr> "Block Group 2", "Block Group 2", "Block Group 1", "Block Gr~
## $ bg_area   <dbl> 231417.4, 231417.4, 524342.2, 325562.6, 375436.5, 406618.2, ~
## $ ab        <chr> "0071002", "0071002", "0051001", "0067002", "0168011", "0178~
## $ cd_id     <dbl> 107, 209, 107, 107, 107, 107, 113, 107, 107, 209, 107, 107, ~
## $ people_in <dbl> 845, 0, 872, 898, 678, 814, 0, 923, 709, 0, 1003, 847, 0, 97~
## $ units_in  <dbl> 515, 0, 444, 590, 504, 464, 0, 638, 530, 0, 810, 762, 0, 686~
## $ people    <dbl> 846, 846, 872, 898, 678, 814, 814, 923, 709, 709, 1003, 847,~
## $ units     <dbl> 516, 516, 444, 590, 504, 464, 464, 638, 530, 530, 810, 762, ~
## $ w_p       <dbl> 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, ~
## $ w_u       <dbl> 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, ~
## $ estimate  <dbl> 14, 14, 13, 23, 3, 58, 58, 123, 0, 0, 0, 13, 13, 34, 0, 0, 0~
## $ geometry  <POLYGON [°]> POLYGON ((-94.6074 39.04299..., POLYGON ((-94.6074 3~
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): attribute variables are
## assumed to be spatially constant throughout all geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Blocks inside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950096003000     100      0     0         0        0
## 2  290950096003001     100      0     0         0        0
## 3  290950096003002     100      0     0         0        0
## 4  290950096003005     100      0     0         0        0
## 5  290950096003006     100      0     0         0        0
## 6  290950096003004      98      0     0         0        0
## 7  290950096003007      96      0     0         0        0
## 8  290950096003003      95      0     0         0        0
## 9  290950096003008      44      0     0         0        0
## 10 290950096003009      43      0     0         0        0
## 
## Blocks outside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950096003010       0      0     0         0        0
## 2  290950096003011       0      0     0         0        0
## 3  290950096003012       0      0     0         0        0
## 4  290950096003013       0      0     0         0        0
## 5  290950096003014       0      0     0         0        0
## 6  290950096003015       0      0     0         0        0
## 7  290950096003016       0      0     0         0        0
## 8  290950096003017       0      0     0         0        0
## 9  290950096003018       0      0     0         0        0
## 10 290950096003019       0      0     0         0        0
## 11 290950096003020       0      0     0         0        0
## 12 290950096003021       0      0     0         0        0
## 13 290950096003022       0      0     0         0        0
## 14 290950096003023       0      0     0         0        0
## 15 290950096003024       0      0     0         0        0
## 16 290950096003025       0      0     0         0        0
## 17 290950096003026       0      0     0         0        0
## 18 290950096003027       0      0     0         0        0
## 19 290950096003028       0      0     0         0        0
## 20 290950096003029       0      0     0         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1         0        0      0     0
## 
## Cross check
## 
##   people_in units_in people units
## 1         0        0      0     0
## 
## 
## bg2
## 
## Rows: 14
## Columns: 13
## $ bg_id     <chr> "290959801011", "290959801011", "290959801011", "29095980101~
## $ bg_name   <chr> "Block Group 1", "Block Group 1", "Block Group 1", "Block Gr~
## $ bg_area   <dbl> 6780470, 6780470, 6780470, 6780470, 5122721, 5122721, 512272~
## $ ab        <chr> "9801011", "9801011", "9801011", "9801011", "0172003", "0172~
## $ cd_id     <dbl> 101, 105, 109, 110, 101, 110, 125, 126, 101, 105, 110, 109, ~
## $ people_in <dbl> 0, 0, 0, 3, 0, 540, 0, 0, 0, 3, 1061, 0, 0, 0
## $ units_in  <dbl> 0, 0, 0, 2, 0, 352, 0, 0, 0, 2, 524, 0, 0, 0
## $ people    <dbl> 3, 3, 3, 3, 540, 540, 540, 540, 1064, 1064, 1064, 0, 0, 0
## $ units     <dbl> 2, 2, 2, 2, 352, 352, 352, 352, 526, 526, 526, 0, 0, 0
## $ w_p       <dbl> 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, NaN, NaN, NaN
## $ w_u       <dbl> 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, NaN, NaN, NaN
## $ estimate  <dbl> 0, 0, 0, 0, 76, 76, 76, 76, 52, 52, 52, 0, 0, 0
## $ geometry  <POLYGON [°]> POLYGON ((-94.54252 39.0057..., POLYGON ((-94.54252 39.0057.~
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Warning: Removed 3 rows containing missing values (geom_text).

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Blocks inside cd
## 
##             bl_id prop_in people units people_in units_in
## 1 290950073021014     100      0     0         0        0
## 2 290950073021015     100      0     0         0        0
## 3 290950073021016     100      0     0         0        0
## 4 290950073021012      98      0     0         0        0
## 5 290950073021013      98      0     0         0        0
## 
## Blocks outside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290950073021010       0    428   437         0        0
## 2  290950073021005       0    242   188         0        0
## 3  290950073021009       0     94    84         0        0
## 4  290950073021011       0     39    33         0        0
## 5  290950073021006       0     32    18         0        0
## 6  290950073021001       0     12     2         0        0
## 7  290950073021000       0      0     0         0        0
## 8  290950073021002       0      0     0         0        0
## 9  290950073021003       0      0     0         0        0
## 10 290950073021004       0      0     0         0        0
## 11 290950073021007       0      0     0         0        0
## 12 290950073021008       0      0     0         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1         0        0    847   762
## 
## Cross check
## 
##   people_in units_in people units
## 1         0        0    847   762
## 
## 
## bg2
## 
## Rows: 12
## Columns: 13
## $ bg_id     <chr> "290950073021", "290950073021", "290950085004", "29095007200~
## $ bg_name   <chr> "Block Group 1", "Block Group 1", "Block Group 4", "Block Gr~
## $ bg_area   <dbl> 226719.1, 226719.1, 524300.8, 1331657.8, 1331657.8, 1331657.~
## $ ab        <chr> "0073021", "0073021", "0085004", "0072001", "0072001", "0072~
## $ cd_id     <dbl> 107, 112, 112, 103, 107, 112, 112, 112, 112, 112, 112, 112
## $ people_in <dbl> 847, 0, 990, 0, 0, 766, 775, 1279, 687, 766, 1130, 746
## $ units_in  <dbl> 762, 0, 348, 0, 0, 359, 253, 496, 264, 339, 438, 291
## $ people    <dbl> 847, 847, 990, 767, 767, 767, 775, 1279, 687, 766, 1130, 746
## $ units     <dbl> 762, 762, 348, 359, 359, 359, 253, 496, 264, 339, 438, 291
## $ w_p       <dbl> 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1
## $ w_u       <dbl> 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1
## $ estimate  <dbl> 13, 13, 109, 16, 16, 16, 18, 117, 67, 92, 109, 56
## $ geometry  <POLYGON [°]> POLYGON ((-94.59873 39.0388..., POLYGON ((-94.59873 39.0388.~
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): attribute variables are
## assumed to be spatially constant throughout all geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Blocks inside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290470203004008     100    213    99       213       99
## 2  290470203004014     100    182    95       182       95
## 3  290470203004006     100    142    54       142       54
## 4  290470203004009     100     79    26        79       26
## 5  290470203004010     100     65    16        65       16
## 6  290470203004015     100     65    44        65       44
## 7  290470203004000     100     48    23        48       23
## 8  290470203004011     100     40    16        40       16
## 9  290470203004024     100     10     2        10        2
## 10 290470203004007     100      0     0         0        0
## 11 290470203004012     100      0     0         0        0
## 12 290470203004022     100      0     0         0        0
## 13 290470203004023     100      0     0         0        0
## 14 290470203004013      99    330   185       328      184
## 15 290470203004001      99     50    13        49       13
## 16 290470203004002      99     41    13        41       13
## 
## Blocks outside cd
## 
##             bl_id prop_in people units people_in units_in
## 1 290470203004016       1     73    38         1        0
## 2 290470203004004       1     64    22         1        0
## 3 290470203004003       0      7     4         0        0
## 4 290470203004018       0     61    27         0        0
## 5 290470203004005       0     42    13         0        0
## 6 290470203004019       0     34    14         0        0
## 7 290470203004017       0     33    14         0        0
## 8 290470203004021       0     33    11         0        0
## 9 290470203004020       0     24    12         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1      1264      585   1636   741
## 
## Cross check
## 
##   people_in units_in people units
## 1      1264      585   1636   741
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Blocks inside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290470209021014     100    442   214       442      214
## 2  290470209021009     100    199    95       198       95
## 3  290470209021023     100     82    34        82       34
## 4  290470209021012     100     67    22        67       22
## 5  290470209021010     100     65    25        65       25
## 6  290470209021025     100     60    54        60       54
## 7  290470209021017     100     57    21        57       21
## 8  290470209021011     100     52    23        52       23
## 9  290470209021013     100     47    18        47       18
## 10 290470209021015     100     31     9        31        9
## 11 290470209021016     100     25    13        25       13
## 12 290470209021024     100     18     8        18        8
## 13 290470209021026     100      0     0         0        0
## 14 290470209021018      99     55    23        54       23
## 15 290470209021001      97      0     0         0        0
## 16 290470209021000      96      0     0         0        0
## 
## Blocks outside cd
## 
##              bl_id prop_in people units people_in units_in
## 1  290470209021002       1    155    61         2        1
## 2  290470209021022       0      6     3         0        0
## 3  290470209021019       0     76    35         0        0
## 4  290470209021021       0     48    20         0        0
## 5  290470209021020       0     45    22         0        0
## 6  290470209021003       0     41    17         0        0
## 7  290470209021004       0      0     0         0        0
## 8  290470209021005       0      0     0         0        0
## 9  290470209021006       0      0     0         0        0
## 10 290470209021007       0      0     0         0        0
## 11 290470209021008       0      0     0         0        0
## 
## Totals
## 
##   people_in units_in people units
## 1      1200      560   1571   717
## 
## Cross check
## 
##   people_in units_in people units
## 1      1200      560   1571   717
## 
## 
## bg2
## 
## Rows: 19
## Columns: 13
## $ bg_id     <chr> "290470209015", "290470203002", "290470203004", "29047020300~
## $ bg_name   <chr> "Block Group 5", "Block Group 2", "Block Group 4", "Block Gr~
## $ bg_area   <dbl> 1286304.4, 936571.5, 2436892.8, 2436892.8, 994463.9, 994463.~
## $ ab        <chr> "0209015", "0203002", "0203004", "0203004", "0209011", "0209~
## $ cd_id     <dbl> 119, 119, 119, 120, 119, 122, 119, 119, 119, 119, 122, 119, ~
## $ people_in <dbl> 1333, 1776, 1264, 2, 1117, 3, 1525, 671, 988, 1200, 0, 991, ~
## $ units_in  <dbl> 667, 721, 585, 1, 388, 1, 640, 390, 486, 560, 0, 386, 535, 4~
## $ people    <dbl> 1339, 1776, 1636, 1636, 1129, 1129, 1525, 674, 988, 1571, 15~
## $ units     <dbl> 671, 721, 741, 741, 392, 392, 640, 391, 486, 717, 717, 386, ~
## $ w_p       <dbl> 1.00, 1.00, 0.77, 0.00, 0.99, 0.00, 1.00, 1.00, 1.00, 0.76, ~
## $ w_u       <dbl> 0.99, 1.00, 0.79, 0.00, 0.99, 0.00, 1.00, 1.00, 1.00, 0.78, ~
## $ estimate  <dbl> 253, 237, 179, 179, 89, 89, 65, 64, 14, 64, 64, 139, 187, 14~
## $ geometry  <POLYGON [°]> POLYGON ((-94.54883 39.1869..., POLYGON ((-94.56736 ~
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data